<template>
  <div>
    <div class="head">
      <a @click="prev" id="btn_back_info" class="return"></a>基本信息
    </div>
  <div class="weui-tab weui-fixed weui-tab_apply" style="padding-top: 45px;">
    <div class="weui-tab__bd weui_paddingdown">
      <div id="tab1" class="weui-tab__bd-item weui-tab__bd-item--active">
        <form id="applyInfoForm">
          <div class="weui-cells weui-cells_form">
            <div class="weui-cell">
              <div class="weui-cell__hd">
                <label class="weui-label">姓名</label></div>
              <div class="weui-cell__bd">
                <input name="cusName" id="cusName" value="" class="weui-input" type="text" placeholder="请输入姓名">
              </div>
            </div>
            <div class="weui-cell">
              <div class="weui-cell__hd">
                <label class="weui-label">身份证号</label></div>
              <div class="weui-cell__bd">
                <input name="certNo" id="certNo" value="" class="weui-input" type="text" placeholder="请输入身份证号">
              </div>
            </div>
            <div class="weui-cell weui_lineheight">
              <div class="weui-cell__hd">
                <label class="weui-label">所在城市</label></div>
              <div class="weui-cell__bd">
                <input id="city" name="city" class="weui-input" type="text" placeholder="请选择城市" value="">
              </div>
            </div>
            <div class="weui-cell weui_lineheight">
              <div class="weui-cell__hd">
                <label class="weui-label">住房情况</label>
              </div>
              <div class="weui-cell__bd">
                <select class="weui-select" name="houseType" id="houseType">
                  <option value="">请选择有无房产</option>
                  <option value="1">自置商品房</option>
                  <option value="2">自建房</option>
                  <option value="3">住亲属处</option>
                  <option value="4">租赁居住</option>
                  <option value="5">其他</option>
                </select>
              </div>
            </div>
            <div class="weui-cell">
              <div class="weui-cell__hd">
                <label class="weui-label">企业名称</label></div>
              <div class="weui-cell__bd">
                <input name="entName" id="entName" value="" class="weui-input" type="text" placeholder="请输入企业名称">
              </div>
            </div>
            <div class="weui-cell">
              <div class="weui-cell__hd">
                <label class="weui-label">年营业收入</label></div>
              <div class="weui-cell__bd">
                <input name="turnover" id="turnover" class="weui-input" type="number" pattern="[0-9]*" placeholder="请输入年营业收入">
              </div>
              <div class="weui-cell__ft">
                <div class="weui-vcode_unit">元</div>
              </div>
            </div>
            <div class="weui-cell">
              <div class="weui-cell__hd">
                <label class="weui-label">单位名称</label></div>
              <div class="weui-cell__bd">
                <input name="unitName" id="unitName" value="" class="weui-input" type="text" placeholder="请输入单位名称">
              </div>
            </div>
            <div class="weui-cell">
              <div class="weui-cell__hd">
                <label class="weui-label">年收入</label></div>
              <div class="weui-cell__bd">
                <input name="annualIncome" id="annualIncome" class="weui-input" type="number" pattern="[0-9]*" placeholder="请输入年收入">
              </div>
              <div class="weui-cell__ft">
                <div class="weui-vcode_unit">元</div>
              </div>
            </div>
          </div>
        </form>
      </div>

    </div>
  </div>

  <div class="weui-flex weui-fixed-btm p10 weui-tab__bd-item" id="applyBtnDiv">
    <a @click="applyInfoBtn" class="weui-btn weui-btn_primary_down weui-btn_shenqing">下一步</a>
  </div>

  </div>
</template>

<script>
import $ from 'jquery'
window.jQuery = $
window.$ = $
export default {
  methods: {
    prev: function () {
      this.$router.go(-1)
    },
    applyInfoBtn: function () {
      var cusName = $('#cusName').val()
      if (cusName === '') {
        $.toast('请输入姓名', 'text')
        $('#cusName').focus()
        return
      }
      var certNo = $('#certNo').val()
      if (certNo === '') {
        $.toast('请输入身份证号', 'text')
        $('#certNo').focus()
        return
      }
      if (!this.util.ID(certNo)) {
        $.toast('请输入正确的身份证号', 'text')
        $('#certNo').focus()
        return
      }
      var city = $('#city').val()
      if (city === '') {
        $.toast('请选择城市', 'text')
        $('#city').focus()
        return
      }
      var entName = $('#entName').val()
      if (entName === '') {
        $.toast('请输入企业名称', 'text')
        $('#entName').focus()
        return
      }
      var turnover = $('#turnover').val()
      if (turnover === '') {
        $.toast('请输入年营业收入', 'text')
        $('#turnover').focus()
        return
      }
      var unitName = $('#unitName').val()
      if (unitName === '') {
        $.toast('请输入单位名称', 'text')
        $('#unitName').focus()
        return
      }
      var annualIncome = $('#annualIncome').val()
      if (annualIncome === '') {
        $.toast('请输入年输入', 'text')
        $('#annualIncome').focus()
        return
      }
      var data = $('#applyInfoForm').serialize()
      console.log('基本信息：' + data)
      this.$router.push({ path: '/LoanAsset' })
    }
  },
  mounted () {
    $('#city').cityPicker({
      title: '请选择城市'
    })
  }
}
</script>

<style lang="css" scoped>
@import '../../../assets/styles/loaninfo.css'
</style>
